package com.qys.handler;

import com.qys.util.HttpUtils;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;

public class GetHttpHandler implements HttpHandler{

	@Override
	public void handle(HttpExchange httpExchange) {
		try {
			if(!"GET".equals(httpExchange.getRequestMethod())) {
				HttpUtils.handleResponse(httpExchange, 405, "405 Method Not Allowed");
				return;
			}
			HttpUtils.handleResponse(httpExchange, 200, "This is a GET request.");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
